<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/6/4
  Time: 10:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="/js/jquery-3.3.1.min.js"></script>
    <script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>

    <title>成为分销商</title>
    <style>
        a{
            text-decoration: none;
        }
        *{
            margin: 0;
            padding: 0;
        }
        #app{
            width: 100%;
            height: 100%;
        }
        .huanying{
            width: 100%;
            height: 100%;
        }
        .title{
            width: 100%;
            padding: 15px 0;
            font-size: 20px;
            text-align: center;
        }
        .title>p span{
            color: #f00;
        }
        .inp{
            padding: 10px;
            border-top: 1px solid #eee;
            border-bottom: 1px solid #eee;
        }
        .inp input{
            border: 0;
            outline: none;
            background-color: rgba(0, 0, 0, 0);
        }
        .btn{
            width: 260px;
            height: 40px;
            background-color: orange;
            font-size: 19px;
            color: #fff;
            text-align: center;
            border-radius: 30px;
            line-height: 40px;
            margin: 30px auto ;
        }
        .fenxiao{
            padding: 10px ;
        }
        .fenxiao a{
            color: #2b9de2;

        }
        .tequan{
            width: 100%;
            height: 100%;
            padding: 10px;
        }
        .tequan>p{
            font-size: 18px;
            text-align: center;
            padding: 15px 0;

        }
        .tequan>div{
            border-top: 1px solid #eee;
            border-bottom: 1px solid #eee;
            padding: 10px;
            margin:0 0 10px 0;
        }
        .tequan>div p{
            margin:0 0 10px 0;
            font-size: 17px;
            color: #000;
        }
        .tequan>div span{
            font-size: 15px;
            color: #615c5cf1;
        }
        .tequan>span{


            color: #615c5cf1;
        }
    </style>
</head>
<body>
<div id="app">
    <div id="huanying">
        <div class="title"><p>欢迎加入<span>可乐自由行</span></p></div>
        <div class="inp">姓名&nbsp; &nbsp; <input id="name" type="text" value="${memberInfo.name}"></div>
        <div class="inp">手机号 <input type="text" id="tel" value="${memberInfo.tel}"></div>
        <div class="fenxiao"><input type="checkbox">我已阅读并了解 <a href="">【分销商申请协议】</a></div>

        <c:choose>
            
            <c:when test="${memberInfo.apply == 0}">

                <div  class="btn" onclick="x();">申请成为分销商</div>

            </c:when>

            <c:when test="${memberInfo.apply == 1}">

                <div  class="btn" >审核中</div>

            </c:when>

            <c:otherwise>

                <div  class="btn" >已成为分销商</div>

            </c:otherwise>
            
        </c:choose>


    </div>
    <div class="tequan">
        <p>分销商特权</p>
        <div>
            <!-- <img src="" alt=""> -->
            <p>销售拿佣金</p>
            <span>成为分销商后卖出商品,您可以获得佣金</span>
        </div>
        <span>分销审核请联系在线客服</span>
        <%--<span>分销商的商品销售统一由厂家直接收购，直接发货，并提供产品的售后服务，分销金额由厂家统一设置</span>--%>
    </div>
</div>
<script>
    function x() {

        var tel=$("#tel").val();

        var name=$("#name").val();

        if (tel==""){

            alert("请填姓名");
            return false;
        }

        if (tel==""){

            alert("请填写手机号");
            return false;
        }


        $.ajax({
            url:'/applet/memberServoce',
            type:'POST', //GET
            async:true,    //或false,是否异步
            data:{
                memberId:'${memberId}',
                tel:$("#tel").val(),
                name:$("#name").val()
            },
            timeout:5000,    //超时时间
            dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text
            beforeSend:function(xhr){


            },
            success:function(reData){
                console.log(reData);
                if(reData.code=='000000'){
                    //alert("提交成功");
                    wx.miniProgram.navigateBack({
                        delta: 1
                    })
                }
            },
            error:function(xhr,textStatus){
                console.log('错误')
                console.log(xhr)
                console.log(textStatus)
            },
            complete:function(){
                //console.log('结束')
            }
        });
    }





</script>
</body>
</html>
